package org.testis.testdriver;

/**
 * @author barisergun
 */
import org.testis.data.TestStepResultType;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;

public interface ITestBuilder {

    /**
     * This is the pure abstract method used to get the root TestPart object. 
     */
    public TestPart getResult();

    /**
     * This is the pure abstract method used to build a Test Suite. 
     * @param testSuiteId The id of Test Suite StepContainer 
     * @param testSuiteName The name of Test Suite StepContainer 
     * @param testSuiteDescription The description of Test Suite StepContainer
     */
    public void buildTestSuite(String testSuiteId,
            String testSuiteName,
            String testSuiteDescription);

    /**
     * This is the pure abstract method that will be forced to be implemented,
     * to build a StepContainer. 
     * @param testPartId The id of StepContainer 
     * @param testPartName The name of StepContainer 
     * @param testPartDesc The description of StepContainer
     * @param containerType The type of StepContainer as StepContainerType
     * @param parentTestPartId The id of the parent StepContainer
     * @see StepContainerType
     */
    public void buildTestPart(String testPartId,
            String testPartName,
            String testPartDesc,
            AtofEnumaration.TestPartType containerType,
            String parentTestPartId);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set StepContainer run time parameters. 
     * @param testPartId The id of StepContainer      
     * @param invokeCount The number of the invocation count for the current 
     * Test Case StepContainer(NA).
     * @param noOfThreads The number of the thread pools that will be used (NA). 
     */
    public void setTestCaseThreading(String testPartId,
            int invokeCount,
            int noOfThreads);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set StepContainer run time parameters. 
     * @param testPartId The id of StepContainer      * 
     * @param noOfRetryOnFail The number of the retry counts if the StepContainer 
     * fails (NA).     
     */
    public void setTestCaseRetyrOnFail(String testPartId,
            int noOfRetryOnFail);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set Test Case Success Percentage attribute. This attribute is only 
     * needed by the TestCase type StepContainer. 
     * @param testPartId The id of StepContainer
     * @param successPercentage The percentage of success expected by all the 
     * iterations of the Test Case (a value between 0-100)
     */
    public void setTestCaseSuccessPerc(String testPartId,
            short successPercentage);
    

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set Test Parts dependency to the result of other Test Parts indicated
     * here. 
     * @param testPartId The id of StepContainer
     * @param depParts The list of the TestPart that this StepContainer depends 
     * @param runAlways The flag to indicate wheter to run even if the dpendent
     * StepContainer have failed.
     */
    public void setTestPartDependency(String testPartId,
            String[] depParts,
            boolean runAlways);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set Test Plan StepContainer run time parameters.
     * @param testPartId The id of StepContainer       
     * @param versDutFw The version of the DUT.
     * @param dutName The model name of the DUT.
     * @param browserType The type of the browser will be used during the project.
     * @param currentIp The ip address of the Dut if stated.
     * @param testBedIp The test bed ip address of the Dut.
     */
    public void setTestPlanDutRunTime(String testPartId,
            String versDutFw,
            String dutName,
            String browserType,
            int browserSpeed,
            String currentIp,
            String testBedIp);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set Test Plan StepContainer run time parameters.
     * @param testPartId The id of StepContainer  
     * @param versATOF The version of the current TestFramework. 
     * @param testPcMacAddr The mac address of the Test PC. 
     */
    public void setTestPlanTestPcRunTime(String testPartId,
            String versATOF,
            String testPcMacAddr);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set Test Plan Globals like profile and language vraible files.
     * @param testPartId The id of StepContainer  
     * @param deviceLangId The id of the Language Variables file. 
     * @param globalProId The id of the Global Variables file. 
     */
    public void setTestPlanGlobals(String testPartId,
            Integer deviceLangId,
            Integer globalProId);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set Test Plan StepContainer run time parameters.
     * @param testPartId The id of StepContainer  
     * @param dutSerialConf The dictionary that contains DUT Serial Connection Data
     */
    public void setTestPlanDutSerial(String testPartId,
            HashMap<String, String> dutSerialConf);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set critical flag for the StepContainer. 
     * @param testPartId The id of StepContainer 
     * @param isCritical The flag indicating if the TestPart is ciritical or not.     
     */
    public void setIsCriticalPart(String testPartId,
            boolean isCritical);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to build a TestSTep and attach it to a Test Case (StepContainer). 
     * @param testStepId The id of TestPart 
     * @param testStepName The name of the TestStep.     
     * @param partDescription The description of the TestStep.
     * @param parentTestPart The id of the parent StepContainer.
     */
    public void buildTestStep(String testStepId,
            String testStepName,
            String partDescription,
            String parentTestPart);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set a TestSTep parameters. 
     * @param testStepId The id of TestStep 
     * @param testPcName The name of the Test PC that Framework is installed.     
     * @param moduleName The name of the module that will be invoked.
     * @param actName The name of the action that will be taken.
     * @param supportedDevices The list of the supported devices for this step.
     */
    public void setTestStepParam(String testStepId,
            String testPcMacAddress,
            AtofEnumaration.AtofModule moduleName,
            String actName,
            String[] supportedDevices,
            String storePostfix);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set a TestSTep runtime parameters. 
     * @param testStepId The id of TestStep 
     * @param timeOut The timeout value of the TestStep
     * @param timeOutAfterExecute The timeout value of the TestStep after execution.
     * @param delayTime The delay time value of the TestStep
     * @param noOfRetryOnFail The .number of retry counts if Test Step Fails.
     * @param isAsynch The value indicating if the TestStep is executed asynchronously.
     * @param dataArrayAppliesToCase The flag indicating if the DataObject Array elements
     * applies to TestCase.
     * @param isCritical The flag indicating wheter the TestStep is critical or not.
     */
    public void setTestStepRunTime(String testStepId,
            int timeOut,            
            int delayTime,
            int delayTimeAfterExecute,
            int noOfRetryOnFail,
            boolean isAsynch,
            boolean dataArrayAppliesToCase,
            boolean isCritical);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to set a TestSTep runtime parameters. 
     * @param testStepGroupId The id of TestStepGroup 
     * @param noOfRetryOnFail The .number of retry counts if Test Step Fails.
     * @param isCritical The flag indicating wheter the TestStep is critical or not.
     */
    public void setTestStepGroupRunTime(String testStepGroupId,
            int noOfRetryOnFail,
            boolean isCritical);

    /**
     * 
     * @param 
     */
    public void setTestStepSuccessPerc(String testStepId,
            short successPercentage);

    /**
     * 
     * @param 
     */
    public void setTestStepModuleParams(String testStepId,
            LinkedHashMap<String, String> degers);

    /**
     * This is the pure abstract method that will be forced to be implemented
     * to attach a DataObject to a TestStep. 
     * @param dataObjId The id of DataObject 
     * @param dataObjType The type of the DataObject     
     * @param expResult The expected result when DataObject applied.     
     * @param dataPairs The key value pairs of data that will be applied
     * @param conditions LinkedList of string of conditions.
     * @param testStepToAttach The id of the TestStep that data object will be attached.     
     */
    public void attachDataToStep(String dataObjId,
            String dataObjName,
            TestStepResultType expResult,
            LinkedHashMap<String, String> dataPairs,
            LinkedList<String> conditions,
            String testStepToAttach);

    /**
     *
     * @param testPartId Unique Id of the TestPart
     * @param conditions LinkedList of Strings of conditions.
     */
    public void setTestPartConditions(String testPartId,
            LinkedList<String> conditions);
}


